const axios = require('axios')
const get = axios.create()
get.interceptors.request.use((config) => {
    config.method = 'get'
    return config
}, error => Promise.reject(error))
get.interceptors.response.use((response) => {
    return (response.status === 200) ? response : Promise.reject('[ERROR] response.status: ' + response.status)
}, error => Promise.reject(error))
const $get = async (request) => {
    const response = await get(request).catch((e) => {
        console.log(e)
    })
    return !!response ? response : false
}
module.exports = $get